package com.zhoukun.cloud.controller;

import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.math.BigDecimal;

/**
 * @author zhoukun 86547462@qq.com
 * @version 1.0
 * @date 2020/10/24 21:06
 */
@RestController
@Log4j2
public class PaymentController {
    @Autowired
    RestTemplate template;

    private static final String PAYMENT_URL="http://localhost:8001";
    //查询
    @GetMapping("/con/query")
    public String query()
    {
        return template.getForObject(PAYMENT_URL+"/payment/query", String.class);
    }


    //查询单个
    @GetMapping("/con/queryById/{Id}")
    public String queryById(@PathVariable String Id)
    {
        return template.getForObject(PAYMENT_URL+"/payment/queryById/"+Id, String.class);
    }

    //修改余额
    @GetMapping("/con/banUP/{Id}/{money}")
    public String banUP(@PathVariable String Id,
                             @PathVariable BigDecimal money)
    {

        return template.getForObject(PAYMENT_URL+"/payment/banUP/"+Id+"/"+money, String.class);
    }

}
